<template>
  <div class="header">
    <div class="top-bar">
      <el-dropdown trigger="click">
        <span class="el-dropdown-link">
          多源数据加载<el-icon class="el-icon--right"><arrow-down /></el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item :icon="Plus" @click="addImage">添加影像底图</el-dropdown-item>
            <el-dropdown-item :icon="CirclePlusFilled" @click="addVector">
              添加矢量底图
            </el-dropdown-item>
            <el-dropdown-item :icon="CirclePlus" @click="addGeojson">添加矢量数据</el-dropdown-item>
            <el-dropdown-item :icon="Check">添加img数据</el-dropdown-item>
            <el-dropdown-item :icon="CircleCheck">添加geojson数据</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
    <div class="top-bar">
      <el-dropdown trigger="click">
        <span class="el-dropdown-link">
          绘制功能<el-icon class="el-icon--right"><arrow-down /></el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item :icon="Plus">画点</el-dropdown-item>
            <el-dropdown-item :icon="CirclePlusFilled">
              画线
            </el-dropdown-item>
            <el-dropdown-item :icon="CirclePlus">画面</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
    <div class="top-bar">{{ info }}</div>
    <div class="top-bar">
      <el-dropdown trigger="click">
        <span class="el-dropdown-link">
          添加GeoServer服务<el-icon class="el-icon--right"><arrow-down /></el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item :icon="Plus">添加WMTS服务</el-dropdown-item>
            <el-dropdown-item :icon="CirclePlusFilled" @click="addWMSLayer">
              添加WMS服务
            </el-dropdown-item>
            <el-dropdown-item>
              添加WFS服务
            </el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
    <div class="top-bar">
      <el-dropdown trigger="click">
        <span class="el-dropdown-link">
          图层管理<el-icon class="el-icon--right"><arrow-down /></el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item :icon="Plus">影像</el-dropdown-item>
            <el-dropdown-item :icon="CirclePlusFilled">
              矢量
            </el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import olMap from "../utils/olUtils";
import { Plus, CirclePlusFilled, CirclePlus, Check, CircleCheck, ArrowDown } from "@element-plus/icons-vue";
const info = ref("Openlayers系列功能展示");
//天地图影像
const addImage = () => {
  olMap.addImgBaseMap();
};
//天地图矢量地图
const addVector = () => {
  console.log("addVector");
  olMap.addVecBasemap();
};
//添加geojson数据
const addGeojson = () => {
   // 添加矢量数据
  olMap.addVecData();
}
//wms服务
const addWMSLayer = () => {
  olMap.addWMS();
  
}

</script>

<style scoped>
.header {
  width: 100vw;
  height: 8vh;
  position: absolute;
  top: 0;
  background-image: url("../assets/head_bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 100;
  display: flex;
  align-items: center;
  color: #fff;
  font-size: 0.8rem;
  font-weight: bold;
  background-color: rgb(13, 116, 219);
}

.top-bar {
  color: #73efff;
  font-size: 23px;
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.el-dropdown-link {
  color: #c2c2c2;
  font-size: 18px;
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  cursor: pointer;
}
</style>
